package com.macrog.rabbitmq.route;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.macrog.rabbitmq.utils.ConnectionFactoryUtil;

import java.io.IOException;

/**
 * Created by Administrator on 2018/9/2.
 */
public class Send {

    private static final String EXCHANGE_NAME = "routeExchange";

    public static void main(String[] args) throws IOException {
        Connection connection = ConnectionFactoryUtil.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare(EXCHANGE_NAME,"direct");

        String message = "路由模式消息";
        channel.basicPublish(EXCHANGE_NAME,"key1",null,message.getBytes());

        ConnectionFactoryUtil.release(connection,channel);
    }
}
